#include<bits/stdc++.h>
using namespace std;
#define ls (rt<<1)
#define rs (rt<<1|1)
#define int long long
const int maxn = 1e6+7;
// L, R: 记录idx的树的分管区间; sum: 记录idx的树的区间的和
int L[maxn<<2], R[maxn<<2], sum[maxn<<2];
int n, q;
int a[maxn];
void pushup(int rt) {
    sum[rt] = sum[ls]+sum[rs];
}
void Build(int rt, int l, int r) {
    L[rt] = l, R[rt] = r;
    if(l==r) {
        cin>>sum[rt];
        return;
    }
    int mid = (l+r)/2;
    Build(ls, l, mid);
    Build(rs, mid+1, r);
    pushup(rt);
}
void Add(int rt, int i, int x) {
    if(L[rt] == R[rt]) {
        sum[rt] += x;
        return;
    }
    int l=L[rt], r=R[rt];
    int mid = (l+r)/2;
    if(i<=mid) Add(ls, i, x);
    else Add(rs, i, x);
    pushup(rt);
}
int Query(int rt, int l, int r) {
    if(L[rt]==l && r==R[rt]) return sum[rt];
    int mid = (L[rt]+R[rt])/2;
    if(r<=mid) return Query(ls, l ,r);
    else if(l>=mid+1) return Query(rs, l, r);
    return Query(ls, l, mid) + Query(rs, mid+1, r);
}
signed main() {
    cin>>n>>q;
    Build(1, 1, n);
    // for(int i=1; i<=n; ++i) cin>>a[i];
    while(q--) {
        int op, a, b;
        cin>>op>>a>>b;
        if(op==1) {
            Add(1, a, b);
        }
        else {
            cout<<Query(1, a, b)<<'\n';
        }
    }
}
